import { RouteRecordRaw, RouterView } from 'vue-router'

import { redirectPath } from '../help'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/admin/algo-service-manage',
    component: RouterView,
    meta: { title: '算法仓库', auth: ['algo-service-list'] },
    redirect: redirectPath,
    children: [
      {
        path: '/admin/algo-service-manage/list',
        component: () => import('@/views/admin/algo-service-manage/list/index.vue'),
        meta: { title: '算法列表', auth: ['algo-service-list'] }
      },
      {
        path: '/admin/algo-service-manage/call-record',
        component: () => import('@/views/admin/algo-service-manage/call-record/index.vue'),
        meta: { title: '调用记录', auth: ['algo-call-record'] }
      },
      {
        path: '/admin/algo-service-manage/add',
        component: () => import('@/views/admin/algo-service-manage/edit/service.vue'),
        meta: { title: '新建算法', auth: ['algo-service-add'] }
      },
      {
        path: '/admin/algo-service-manage/edit/:id',
        component: () => import('@/views/admin/algo-service-manage/edit/service.vue'),
        meta: { title: '编辑算法', auth: ['algo-service-edit'] }
      },
      {
        path: '/admin/algo-service-manage/detail/:id',
        component: () => import('@/views/admin/algo-service-manage/detail/service.vue'),
        meta: { title: '算法详情', auth: ['algo-service-list'] }
      },
      {
        path: '/admin/algo-service-manage/version-add',
        component: () => import('@/views/admin/algo-service-manage/edit/version.vue'),
        meta: { title: '新增版本', auth: ['algo-version-add'] }
      },
      {
        path: '/admin/algo-service-manage/version-edit/:id',
        name: 'version-edit',
        meta: { title: '版本编辑', auth: 'algo-version-edit' },
        component: () => import('@/views/admin/algo-service-manage/edit/version.vue')
      },
      {
        path: '/admin/algo-service-manage/version-detail/:id',
        name: 'version-detail',
        meta: { title: '版本详情', auth: 'algo-service-list' },
        component: () => import('@/views/admin/algo-service-manage/detail/version.vue')
      }
    ]
  }
]

export default routes
